package main

import (
	"fmt"
	"time"
)

func prod(p chan int) {
	for i := 0; i < 0xffffffff; i++ {
		p <- i
		fmt.Printf("prod %d\n", i)
		time.Sleep(time.Millisecond * 10)
	}
	close(p)
}

func consumer(p chan int) {
	for {
		i := <-p
		fmt.Printf("consumer %d\n", i)
	}
}

func main() {
	p := make(chan int)
	go consumer(p)
	go prod(p)
	time.Sleep(time.Second * 20)
}
